package cn.project.lemontree.service.impl;

import cn.project.lemontree.bean.Teacher;
import cn.project.lemontree.dao.TeacherDao;
import cn.project.lemontree.service.TeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> implements TeacherService {
    @Resource
    private TeacherDao teacherDao;
    @Override
    public List<Teacher> listpage(int page, int size, String teacherName,String telephone) {
        return teacherDao.listPage((page-1)*size,size,teacherName,telephone);
    }

    @Override
    public int count(String teacherName,String telephone) {
        return teacherDao.count(teacherName,telephone);
    }

    @Override
    public boolean saveTeacher(Teacher teacher) {
        return teacherDao.save(teacher)>0;
    }

    @Override
    public Teacher login(String telephone){
        return teacherDao.login(telephone);
    }

    @Override
    public boolean update(Teacher teacher) {
        return teacherDao.update(teacher)>0;
    }

    @Override
    public List<Object> find() {
        return teacherDao.find();
    }

    @Override
    public Teacher findBytp(String telephone){
        return teacherDao.findBytp(telephone);
    }

    @Override
    public Teacher findByid(Integer teacherId){
        return teacherDao.findByid(teacherId);
    }

    @Override
    public List<Teacher> getAllTeachers(){
        return teacherDao.getAllTeachers();
    }

    @Override
    public List<Teacher> findFreeTeachers() {
        return teacherDao.findFreeTeachers();
    }

    @Override
    public List<Map<String, Object>> findTeachersAndClass(int page, int size, String teacherName, String telephone) {
        return teacherDao.findTeachersAndClass((page-1)*size,size,teacherName,telephone);
    }
}
